package org.demo.rmi.server;

import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.RMISocketFactory;

import org.demo.rmi.data.DbAdapter;
import org.demo.rmi.data.DbAdapterImpl;

/**
 * RMI 服务端
 * @author  
 * @date    2010-11-9
 * @file    org.demo.rmi.server.RMIServer.java
 */
public class RMIServer {

	/**
	 * @param args
	 */
	public static void main(String[] args)throws Exception {
		// 启动 rmi 服务，端口为1099
		LocateRegistry.createRegistry(1099);
		// 
		RMISocketFactory.setSocketFactory(new CustomerSocketFactory());
		// 在 rmi 中注册一个对象
		DbAdapter dbadapter = new DbAdapterImpl();
		Naming.rebind("dbadapter", dbadapter);
	}
}
